package com.corona.game;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.g2d.Sprite;
import com.badlogic.gdx.math.Vector2;
import com.corona.Game;
import com.corona.game.util.TextureCache;
import java.util.ArrayList;

/* compiled from: Battle.java */
/* loaded from: pokewilds.jar:com/pkmngen/game/ThrowBait.class */
class ThrowBait extends Action {
    Sprite sprite;
    ArrayList<Integer> frames;
    String sound;
    ArrayList<String> sounds;
    Sprite helperSprite;
    public Action.Layer layer = Action.Layer.gui_120;
    Sprite baitSprite = new Sprite(TextureCache.get(Gdx.files.internal("bait_small1.png")), 0, 0, 8, 8);
    ArrayList<Vector2> positions = new ArrayList<>();
    Vector2 position = new Vector2(32.0f, 64.0f);
    ArrayList<Sprite> sprites = new ArrayList<>();

    public ThrowBait(Game game, Action nextAction) {
        super(new Object[0]);
        this.nextAction = nextAction;
        this.positions.add(new Vector2(8.0f, 12.0f));
        this.positions.add(new Vector2(8.0f, 12.0f));
        this.positions.add(new Vector2(8.0f, 8.0f));
        this.positions.add(new Vector2(8.0f, 8.0f));
        this.positions.add(new Vector2(8.0f, 8.0f));
        this.positions.add(new Vector2(8.0f, 8.0f));
        this.positions.add(new Vector2(8.0f, 2.0f));
        this.positions.add(new Vector2(8.0f, -2.0f));
        this.positions.add(new Vector2(8.0f, -9.0f));
        this.positions.add(new Vector2(8.0f, -9.0f));
        this.positions.add(new Vector2(0.0f, 0.0f));
        this.positions.add(new Vector2(0.0f, 0.0f));
        for (int i = 0; i < 11; i++) {
            this.sprites.add(this.baitSprite);
        }
        this.sprites.add(null);
        this.frames = new ArrayList<>();
        for (int i2 = 0; i2 < 11; i2++) {
            this.frames.add(3);
        }
        this.frames.add(72);
        this.sounds = new ArrayList<>();
        this.sounds.add("throw_rock1");
        for (int i3 = 0; i3 < 11; i3++) {
            this.sounds.add(null);
        }
    }

    @Override // com.corona.game.Action
    public String getCamera() {
        return "gui";
    }

    @Override // com.corona.game.Action
    public Action.Layer getLayer() {
        return this.layer;
    }

    @Override // com.corona.game.Action
    public void step(Game game) {
        if (this.positions.isEmpty() || this.sprites.isEmpty()) {
            game.battle.oppPokemon.currentStats.put("catchRate", Integer.valueOf(game.battle.oppPokemon.currentStats.get("catchRate").intValue() / 2));
            game.battle.oppPokemon.eating += game.map.rand.nextInt(5) + 1;
            if (game.battle.oppPokemon.eating > 255) {
                game.battle.oppPokemon.eating = 255;
            }
            game.battle.oppPokemon.angry = 0;
            System.out.println("eating counter: " + String.valueOf(game.battle.oppPokemon.eating));
            System.out.println("Catch Rate: " + String.valueOf(game.battle.oppPokemon.currentStats.get("catchRate")));
            game.insertAction(new WaitFrames(game, 2, this.nextAction));
            game.actionStack.remove(this);
            return;
        }
        this.sound = this.sounds.get(0);
        if (this.sound != null) {
            game.insertAction(new PlayMusic(this.sound, (Action) null));
            this.sounds.set(0, null);
        }
        this.sprite = this.sprites.get(0);
        if (this.sprite != null) {
            this.sprite.setPosition(this.position.x, this.position.y);
            this.sprite.draw(game.uiBatch);
        }
        if (this.frames.get(0).intValue() > 0) {
            this.frames.set(0, Integer.valueOf(this.frames.get(0).intValue() - 1));
            return;
        }
        this.position = this.position.add(this.positions.get(0));
        this.positions.remove(0);
        this.sprites.remove(0);
        this.frames.remove(0);
        this.sounds.remove(0);
    }
}
